/**
 *  Copyright 2002-2009 the original author or authors.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package foo.bar.wiki.security;

import org.apache.shiro.mgt.*;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.support.DelegatingSubject;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.web.subject.support.WebDelegatingSubject;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.net.InetAddress;

/**
 * An extension of {@link DelegatingSubject}. It currently does everything {@link DelegatingSubject}
 * does. No extension to {@link DelegatingSubject} it extends from.
 *
 * @author tmjee
 * @version $Date: 2009-03-14 14:53:07 +0800 (Sat, 14 Mar 2009) $ $Id$
 */
public class AnonymousSubjectAwareDelegatingSubject extends WebDelegatingSubject {

    private static final Log LOG = LogFactory.getLog(AnonymousSubjectAwareDelegatingSubject.class);



    public AnonymousSubjectAwareDelegatingSubject(PrincipalCollection principals,
                                boolean authenticated,
                                String host, Session session,
                                ServletRequest request, ServletResponse response,
                                org.apache.shiro.mgt.SecurityManager securityManager) {
        super(principals, authenticated, host, session, request, response, securityManager);
    }

     public AnonymousSubjectAwareDelegatingSubject(PrincipalCollection principals,
                                boolean authenticated,
                                InetAddress inetAddress, Session session,
                                ServletRequest request, ServletResponse response,
                                org.apache.shiro.mgt.SecurityManager securityManager) {
        super(principals, authenticated, inetAddress.getHostName(), session, request, response, securityManager);
    }




    /*protected void assertAuthzCheckPossible() throws AuthorizationException {
        // do nothing, we want principle to be able to be empty, eg. when authorizing an anonymous
        // user.
    }*/
}
